
<template>
  <div class="InterviewSituation">
    <!--面包屑导航区域-->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>招聘信息</el-breadcrumb-item>
      <el-breadcrumb-item>面试情况</el-breadcrumb-item>
    </el-breadcrumb>
    <!--卡片视图·-->
    <el-card class="box-card">
      <el-row :gutter="20">
        <el-col :span="7">
          <el-input placeholder="请输入内容" v-model="queryInfo.query" clearable @clear="getUserList" @change="getUserList">
            <el-button slot="append" icon="el-icon-search" @click="getUserList"></el-button>
          </el-input>
        </el-col>
        <el-col :span="4">
          <!-- <el-button type="primary" @click="addDialogVisible=true">添加用户</el-button> -->
        </el-col>
      </el-row>
      <!--用户列表区域-->
      <el-table :data="userList" style="width: 100%" border stripe>
        <el-table-column type="index" label="#" align="center" fixed="left"></el-table-column>
        <el-table-column prop="username" label="姓名" width="180" align="center" fixed></el-table-column>
        <el-table-column prop="role_name" label="角色" min-width="180"></el-table-column>
        <el-table-column prop="graduate_school" label="毕业院校" min-width="180"></el-table-column>
        <el-table-column prop="record" label="学历" min-width="180"></el-table-column>
        <el-table-column prop="professional" label="专业" min-width="180"></el-table-column>
        <el-table-column prop="audit_opinion" label="审核意见" min-width="180"></el-table-column>
        <el-table-column fixed="right" label="操作" width="200">
          <template slot-scope="scope">
            <!--修改按钮-->
            <el-tooltip effect="dark" content="查看" placement="top" :enterable="false">
              <el-button type="primary" icon="el-icon-setting" size="mini" @click="showEditDaialog(scope.row)">
              </el-button>
            </el-tooltip>
            <!--删除按钮-->
            <el-tooltip effect="dark" content="编辑" placement="top" :enterable="false">
              <el-button type="danger" icon="el-icon-edit" size="mini" @click="removeUserById(scope.row.id)">
              </el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <!--分页-->
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :current-page="queryInfo.pagenum" :page-sizes="[2, 5, 10, 30]" :page-size="queryInfo.pagesize"
        layout="total, sizes, prev, pager, next, jumper" :total="userList.length">
      </el-pagination>
      <!-- 查看信息的对话框 -->
      <el-dialog title="添加用户" :visible.sync="settingDialogVisible" width="40%" @close="addDialogClosed('addFormRef')">
        <!-- <span>这是一段信息</span> -->
        <el-form :model="addForm" ref="addFormRef" label-width="70px">
          <el-form-item label="用户名" prop="username">
            <el-input v-model="addForm.username" disabled></el-input>
          </el-form-item>
          <el-form-item label="角色" prop="password">
            <el-input v-model="addForm.role_name" disabled></el-input>
          </el-form-item>
          <el-form-item label="毕业院校" prop="graduate_school">
            <el-input v-model="addForm.email" disabled></el-input>
          </el-form-item>
          <el-form-item label="学历" prop="record">
            <el-input v-model="addForm.mobile" disabled></el-input>
          </el-form-item>
          <el-form-item label="专业" prop="professional">
            <el-input v-model="addForm.professional" disabled></el-input>
          </el-form-item>
          <el-form-item label="审核意见" prop="mobile">
            <el-input v-model="addForm.audit_opinion" type="textarea"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="settingDialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="settingDialogVisible = false">确 定</el-button>
        </span>
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
  import situationList from './situationList.js'
  export default {
    data() {
      return {
        queryInfo: { //请求用户列表的参数
          query: '', //搜索关键字
          pagenum: 1, //页数
          pagesize: 10, //每页的size
        },
        userList: [], //用户列表
        settingDialogVisible: false,
        addForm: { //添加用户的表单
          username: "",
          email: "",
          password: "",
          mobile: ""
        },
      }
    },
    created() {
      this.userList = situationList.row;
    },
    methods: {
      showEditDaialog: function (item) {
        this.settingDialogVisible = true;
        this.addForm = item;
      },
      removeUserById: function () {},
      /**
       * 获取用户列表
       */
      getUserList: function () {

      },
      /**
       * 监听pagesiez的改变
       * newSiez 当前的每一页的size
       */
      handleSizeChange(newSize) {
        this.queryInfo.pagesize = newSize;
        this.getUserList();
      },
      /**
       * 监听页码值变化
       * newPage 当前页
       */
      handleCurrentChange(newPage) {
        this.queryInfo.pagenum = newPage;
        this.getUserList();
      },
      /**
       * 添加用户对话框关闭事件
       */
      addDialogClosed(refName) {
        this.$refs[refName].resetFields();
      },
    }
  }
</script>

<style lang="less" scoped>

</style>